#ifndef __PLAYER_H__
#define __PLAYER_H__

#include "../lib/irrlicht/include/irrlicht.h"
#include "GameDesign.h"

using namespace irr;

class Player
{
public:
	Player(core::stringw pName, int mainAttrib, int rank);
	Player();
	~Player();

	struct AttackType{
		int minDamage, maxDamage;
		int speedPoints;
	};

	int GetRank();
	void PlayerWin();
	void PlayerLose();
	RCHANGE isPlayerRankChange();
	int GetPlayerMainAttribute();

	void SetAttribute(int attrib, int value);
	int GetAttribute(int attrib);

	void SetCurrentDayPoints(int value);
	int GetCurrentDayPoints();
	void SubCurrentDayPoints(int value);
	void AddCurrentDayPoints(int value);

	void DamageTaken(int dmgTaken);
	void ManaUsed(int manaUsed);
	void HealHP(int heal);
	void HealMP(int heal);

	int GetHealthPoint();
	int GetManaPoint();
	int GetSpeed();
	int GetAtk();

	bool GetPlayerKO();

	int GetMaxHP();
	int GetMaxMP();

	void UpdatePlayerStats();

	core::stringw GetPlayerName();

	int atkcooldown;
	int movcooldown;
	int hitcooldown;
	u32 moveTime;
	u32 attackTime;
	u32 hitTime;
	u32 movregtime;
	u32 atkregtime;
	bool m_isMovregen;
	bool m_isAtkregen;
	bool canAct;
	int curX, curY;
	PSTATUS status;
	PFACE face;
	int max_move;
	int max_attack;
	int cur_move;
	int cur_attack;
	int movTimeLapse;
	int atkTimeLapse;
	int sprX;
	int sprY;
	bool isHit;
	core::rect<s32> bPlay;
	core::rect<s32> bMove;
	core::rect<s32> bHit;
	core::rect<s32> bIdle;
	core::rect<s32> bAttack;
	core::rect<s32> bSkill;
	core::rect<s32> position;
	video::ITexture* playerSpr;
	bool isPlayer1;
	int hpbarX;
	int hpbarY;
	int mpbarX;
	int mpbarY;
	double ratio;
	bool m_isDoneRankChange;
private:
	void RankUp();
	void RankDown();
	//Attributes
	int m_AttribMath;
	int m_AttribScience;
	int m_AttribPE;
	int m_MainAttribute;

	int m_HealthPoints;
	int m_ManaPoints;
	int m_CurSpeed;
	int m_Atk;

	int m_MaxHP;
	int m_MaxMP;
	int m_Speed;

	int n_CurrentDayPoints;

	int n_Rank;
	int n_curWinStreak;
	core::stringw s_PlayerName;

	bool m_IsKO;
};

#endif